﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Principal;
using System.Threading;

namespace Win7ThemeEditor
{
    public static class CommonData
    {
        //程序版本（项目属性里面）
        public static string VER = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.Major.ToString() + "." + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.Minor.ToString()+System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.Build.ToString();

        public static bool IsOverwriteSave = false;

        public static bool IsAdmin()
        {
            AppDomain.CurrentDomain.SetPrincipalPolicy(System.Security.Principal.PrincipalPolicy.WindowsPrincipal);
            WindowsPrincipal principal = (WindowsPrincipal)Thread.CurrentPrincipal;
            WindowsIdentity identity = (WindowsIdentity)principal.Identity;

            return (principal.IsInRole(WindowsBuiltInRole.Administrator));
        }
    }
}
